package com.example.controller;

import com.example.config.CzyConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Intellij IDEA<br>
 *
 * @author Planifolia.Van
 * @version 1.0
 * @date 2022/11/15 18:55
 */
@RestController
public class TestController {

    @Resource(name = "czyConfig")
    private CzyConfig config;
    @Value("${spring.profiles.active}")
    private String active;
    /**
     * 第一个测试的Controller方法
     * @return 一个Map信息会自动转化成json
     */
    @RequestMapping("/Test")
    public Map<String,Object> test(){
        Map<String,Object> map = new HashMap<>();
        map.put("name","张三");
        map.put("age",18);
        return map;
    }
    @RequestMapping("/Message")
    public Object getMessage(){
        return config;
    }
    @RequestMapping("/Active")
    public Object getActive(){
        return active;
    }
}
